package com.zyp.jobseeker.enums;

/**
 * 岗位状态枚举
 */
public enum PositionStatus {
    PUBLISHED(0, "已发布"),
    DEPRECATED(1, "已废除");

    private final int code;
    private final String description;

    PositionStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static PositionStatus getByCode(int code) {
        for (PositionStatus status : PositionStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的岗位状态代码: " + code);
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}